//  泛型
class MyArray<T> {
    public Object[] array = new Object[10];

    public void setValue(int pos, T val) {
        array[pos] = val;
    }

    public T getValue(int pos) {
        return (T) array[pos];
    }
}

public class test2 {
    // 将类型进行了传递
    public static void main(String[] args) {
        MyArray<Integer> myArray = new MyArray<>();
        myArray.setValue(1, 10);
        myArray.setValue(0, 100);
        int a = myArray.getValue(1);
        System.out.println(a);
    }
}

